﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Ebc.CustomSerializer.Contracts;
using Ebc.CustomSerializer;
using System.Windows.Forms;

namespace Ebc.DesignerDsl
{
    internal partial class EbcDesignerDslDocData
    {
        private IEbcBoardSerializer _serializer;

        protected override void InitializeComposition()
        {
            base.InitializeComposition();
            _serializer = new EbcBoardSerializer();
            _serializer.Initialize();
        }

        protected override void Save(string fileName)
        {
            base.Save(fileName);

            try
            {
                this._serializer.Save(fileName, this.RootElement as Board);
            }
            catch(ApplicationException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}